package me.hunche.app.domain;

import java.io.Serializable;
import java.util.Date;
import java.util.Set;

import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.persistence.Transient;

import com.feinno.framework.common.domain.AbstractEntity;



@Entity
@Table(name="t_team")
public class Team  extends AbstractEntity implements Serializable{

	private static final long serialVersionUID = -1188709324383452732L;
	@Id 
    @GeneratedValue(strategy = GenerationType.IDENTITY)
	private Long id;
	private String name;
	private Date createTime;
	private Long leaderId;
	
    public Long getLeaderId() {
		return leaderId;
	}
	public void setLeaderId(Long leaderId) {
		this.leaderId = leaderId;
	}
	//	@ManyToOne
//	@JoinColumn(name = "leader_id", referencedColumnName = "leader_id")
	@Transient transient private User leader;
	
//	@OneToMany(cascade = CascadeType.REFRESH, mappedBy = "team")
	@Transient transient  private Set<User> members;
	
	public Long getId() {
		return id;
	}
	public void setId(Long id) {
		this.id = id;
	}
	public String getName() {
		return name;
	}
	public void setName(String name) {
		this.name = name;
	}
	public Date getCreateTime() {
		return createTime;
	}
	public void setCreateTime(Date createTime) {
		this.createTime = createTime;
	}
	
	public User getLeader() {
		return leader;
	}
	public void setLeader(User leader) {
		this.leader = leader;
	}

	public Set<User> getMembers() {
		return members;
	}
	
	public void setMembers(Set<User> members) {
		this.members = members;
	}
	@Override
	public String toString() {
		return "Team [id=" + id + ", name=" + name + ", createTime="
				+ createTime + ", leaderId=" + leaderId + "]";
	}
	
}
